package goodenglish.interfaces.component;

import goodenglish.domain.service.Translator;
import goodenglish.interfaces.BeanFactory;
import goodenglish.interfaces.javafxex.MyTextArea;

/**
 * 解释面板
 * 
 * @author hp
 * 
 */
public class MyExplainPane extends MyTextArea {
	private String spell;
	private String dictType;

	public MyExplainPane(String title, String dictType) {
		super(title);
		this.dictType = dictType;
	}

	public MyExplainPane(String title, String dictType, int width, int height) {
		super(title, width, height);
		this.dictType = dictType;
	}

	/**
	 * 更新拼写
	 */
	public void refreshSpell(String spell) {
		if (this.dictType.equals("ms")) {
			this.setText(translator.englishToChiniseMs(spell));
		} else {
			this.setText(translator.englishToChiniseLocal(spell));
		}

	}

	private Translator translator = BeanFactory.getSingleInstance(Translator.class);
}
